package com.srz.dpm.core.service.impl;

import com.srz.dpm.core.pojo.entity.SuperAdmin;
import com.srz.dpm.core.mapper.SuperAdminMapper;
import com.srz.dpm.core.service.SuperAdminService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 后台超级管理员表 服务实现类
 * </p>
 *
 * @author srz
 * @since 2021-09-09
 */
@Service
@Slf4j
public class SuperAdminServiceImpl extends ServiceImpl<SuperAdminMapper, SuperAdmin> implements SuperAdminService {

    @Override
    public boolean login(String username, String password) {

        Map<String, Object> map = new HashMap<>();
        map.put("username", username);
        map.put("password", password);



        //查询
        List<SuperAdmin> listLogin = baseMapper.selectByMap(map);
        //判断是否为空
        boolean empty = listLogin.isEmpty();
        //看看结果
        System.out.println(listLogin);
        log.info(String.valueOf(listLogin));

        //返回true or false
        if (empty) {
            return false;
        }else {
            return true;
        }

    }
}
